﻿using System;
using System.Linq;
using System.Web.Mvc;
using Trust.Casas.Model;
using Se.Framework.Web.Mvc.Filters;
using Trust.Casas.Web.Models;

namespace Trust.Casas.Web.Controllers
{

    [StaticMethodExecuterInitializerAttribute(typeof(TrustContext), "Initialize")]
    public class HomeController : Controller
    {
        [SimpleMembershipInitializer("InitializeMembership", userIdColumn: "Id", userNameColumn: "Name")]
        public ActionResult Index()
        {
            ViewBag.Message = "Modify this template to jump-start your ASP.NET MVC application.";
            return View();
        }

        public PartialViewResult Map()
        {
            ViewBag.Message = "Modify this template to jump-start your ASP.NET MVC application.";
            Random ran = new Random((int)DateTime.Now.Ticks);
            return PartialView("_Map", new MapData()
            {
                MapName = Guid.NewGuid().ToString(),
                InitialPosition = new MarkerData(-34.7793586, -58.46182190000002),
                Markers = new[]
                    {
                        new MarkerData(-24.7793586, ran.Next(-90,90)){Name ="Casa de sebastian", Description = "Una pequeña descripcion"},
                        new MarkerData(-24.7793586, ran.Next(-90,90)){Name ="Casa de sebastian", Description = "Una pequeña descripcion"},
                        new MarkerData(-24.7793586, ran.Next(-90,90)){Name ="Casa de sebastian", Description = "Una pequeña descripcion"}
                    }
            });
        }
    }
}
